<template>
    <div>
        <i-table border stripe  :columns="format" :data="show_list" height="760">
            <template slot-scope="{ row, index }" slot="action">
                <Button type="error" style="margin-bottom: 5px "  @click="del_xx(index)">删除</Button>
            </template>
        </i-table >
        <div style="text-align: center;margin-top: 10px;">
            <Page ref="page" :total="total" :page-size="pageSize"  @on-change="changePage" show-total/>
        </div>
    </div>
</template>
<script>

import { public_log_list } from  '@/api'
import { post } from '@/api/http'
import { show_simple_page } from '@/common/util' 


export default {
    data() {
        return {
            format: [
                {
                    title: 'Id',key: 'id'
                },
                {
                    title: '批次Id',key: 'release_id',
                },
                {
                    title: '内容',key: 'message'
                },
                {
                    title: '创建时间',key: 'create_time'
                },
                // {
                //     title: '操作',slot: 'action',width: 100,align: 'center'
                // }
            ],
            // 分页
            total_list: [],
            show_list: [],
            total: 0,
            pageSize: 50,
        }
    },
    methods: {
        changePage(index) {
            let _start = (index -1) * this.pageSize
            let _end = index * this.pageSize
            this.show_list = this.total_list.slice(_start,_end)
        },
        btn_edit_release(index){
            let release = this.show_list[index]
            if(release.release_type == 1){
                this.release_edit = release
                this.show_edit_bg_modal = true
            }else if(release.release_type == 2){
                console.log("灰度编辑")
            }
        },
        refresh() {
            post(public_log_list).then(response =>{
                show_simple_page(this,response)
            })
        }
    },
    mounted: function() {
        setTimeout(() =>{
            this.refresh();
        },200); 
    }
}
</script>
<style>
    pre{
        white-space: pre-wrap!important;
        word-wrap: break-word!important;
        *white-space:normal!important;
    }
</style>